<?php

namespace app\service\shopify\action\graph;

class DeliveryGraph extends GraphQLBase
{
    public function getDeliveryProfiles()
    {
        $query = <<<QUERY
query DeliveryZoneList {
  deliveryProfiles(first: 100) {
    edges {
      node {
        id
        name
        profileLocationGroups {
          locationGroup {
            id
          }
          locationGroupZones(first: 10) {
            edges {
              node {
                zone {
                  id
                  name
                  countries {
                    code {
                      countryCode
                      restOfWorld
                    }
                  }
                }
                methodDefinitions(first: 10) {
                  edges {
                    node {
                      id
                      active
                      description
                      name
                      rateProvider{
                        __typename
                ... on DeliveryRateDefinition {
                        price {
                            amount
                            currencyCode
                        }
                }

                      }
                      methodConditions {
                        field
                        operator
                        conditionCriteria {
                          __typename
                          ... on MoneyV2 {
                            amount
                            currencyCode
                          }
                        
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
QUERY;
   return $this->post($query);
    }
}